dynamic class com.c3d.common.events.CentralDispatch
{
    static var _isReady: Boolean = false;

    function CentralDispatch()
    {
    }

    static function initialize()
    {
        if (com.c3d.common.events.CentralDispatch._isReady) 
        {
            return;
        }
        com.c3d.common.events.CentralDispatch._internalDispatchObject = new Object();
        com.c3d.common.events.CentralDispatch._snoopers = new Array();
        mx.events.EventDispatcher.initialize(com.c3d.common.events.CentralDispatch._internalDispatchObject);
        com.c3d.common.events.CentralDispatch._isReady = true;
        return;
    }

    static function get isReady()
    {
        return com.c3d.common.events.CentralDispatch._isReady;
    }

    static function dispatchEvent($event)
    {
        if (com.c3d.common.events.CentralDispatch._isReady) 
        {
            var __reg1 = 0;
            while (__reg1 < com.c3d.common.events.CentralDispatch._snoopers.length) 
            {
                com.c3d.common.events.CentralDispatch._snoopers[__reg1]($event);
                ++__reg1;
            }
            com.c3d.common.events.CentralDispatch._internalDispatchObject.dispatchEvent($event);
            return;
        }
    }

    static function addEventListener($eventType, $closureFunction)
    {
        if (com.c3d.common.events.CentralDispatch._isReady) 
        {
            com.c3d.common.events.CentralDispatch._internalDispatchObject.addEventListener($eventType, $closureFunction);
            return;
        }
    }

    static function removeEventListener()
    {
        if (com.c3d.common.events.CentralDispatch._isReady) 
        {
            com.c3d.common.events.CentralDispatch._internalDispatchObject.removeEventListener();
            return;
        }
    }

    static function addSnooper($snoopingFunction)
    {
        if (com.c3d.common.events.CentralDispatch._isReady) 
        {
            com.c3d.common.events.CentralDispatch._snoopers.push($snoopingFunction);
            return;
        }
    }

    static function removeSnooper($target)
    {
        var __reg1 = 0;
        for (;;) 
        {
            if (__reg1 >= com.c3d.common.events.CentralDispatch._snoopers.length) 
            {
                return;
            }
            if (com.c3d.common.events.CentralDispatch._snoopers[__reg1] == $target) 
            {
                com.c3d.common.events.CentralDispatch._snoopers.splice(__reg1, 1);
            }
            ++__reg1;
        }
    }

}
